//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.jeesite.modules.sd.web;

import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.shiro.realms.D;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sd.common.constants.GlobalEnum;
import com.jeesite.modules.sd.entity.DocDeliverRecord;
import com.jeesite.modules.sd.entity.DocRecv;
import com.jeesite.modules.sd.service.DocDeliverRecordService;
import com.jeesite.modules.sd.service.DocRecvService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author checkZH
 */
@Controller
@RequestMapping({"${adminPath}"})
public class CustomerLoginController extends BaseController {

    @Autowired
    private DocRecvService docRecvService;

    @Autowired
    private DocDeliverRecordService recordService;

    public CustomerLoginController() {
    }

    @RequiresPermissions({"user"})
    @RequestMapping({"customerDesktop"})
    public String desktop(HttpServletRequest request, HttpServletResponse response, Model model) {
        //TODO 封装首页数据 createTime 2020年7月29日15:20:57
        long countDocRecv = docRecvService.findCount(new DocRecv());
        long countWaitTake = recordService.countWaitTake();
        long countWaitReturn = recordService.countWaitReturn();
        long countDeliver = recordService.countDeliver();
        long countDeliverWaitTake = recordService.countDeliverWaitTake();
        long countDeliverWaitReturn = recordService.countDeliverWaitReturn();
        long countDeliverReturn = recordService.countDeliverReturn();
        model.addAttribute("countDocRecv", countDocRecv);
        model.addAttribute("countWaitTake", countWaitTake);
        model.addAttribute("countWaitReturn", countWaitReturn);
        model.addAttribute("countDeliver", countDeliver);
        model.addAttribute("countDeliverWaitTake", countDeliverWaitTake);
        model.addAttribute("countDeliverWaitReturn", countDeliverWaitReturn);
        model.addAttribute("countDeliverReturn", countDeliverReturn);

        return "modules/sys/sysDesktop";
    }
}
